import sensor,image,lcd,time
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_auto_gain(0)#关闭自动增益
sensor.set_hmirror(1)
sensor.set_vflip(1)
sensor.run(1)
b=[75,35,170,170]
while True:
    img=sensor.snapshot()
    img.draw_rectangle(b)#画框
    img.draw_line(0, 0, 319, 239, lcd.WHITE)
    img.draw_line(0, 239, 319, 0, lcd.WHITE)

    img.draw_line(b[0], b[1], b[0]+b[2], b[1]+b[3], lcd.WHITE)
    img.draw_line(b[0], b[1]+b[3], b[0]+b[2], b[1], lcd.WHITE)
    lcd.display(img)
